﻿<%@ Page StylesheetTheme="Skin1" Language="C#" MasterPageFile="~/LTR/MlyLtrMaster.Master"
    AutoEventWireup="true" CodeBehind="Messages.aspx.cs" Inherits="MLY.LTR.Messages"
    Title='<%$Dict:Messages.Title %>' %>

<%@ Register Src="~/UserControls/scrollabelTextArea.ascx" TagName="scrollabelTxt"
    TagPrefix="uc" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content2" ContentPlaceHolderID="titleHolder" runat="server">
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:GridView SkinID="GridViewSkin" ID="GridView1" runat="server" AutoGenerateColumns="False"
        DataSourceID="LinqDataSource1" EnableModelValidation="True" OnPreRender="GridView1_PreRender">
        <Columns>
            <asp:TemplateField HeaderStyle-CssClass="dottedLineRightHeader" ItemStyle-HorizontalAlign="Center"
                HeaderStyle-Width="83">
                <HeaderTemplate>
                    Add<br />
                    <asp:ImageButton runat="server" PostBackUrl="<%#String.Format(&quot;EditMessage.aspx?MsgId=-1&quot;)%>"
                        ImageUrl="~/Images/add_line_icon.png" />
                </HeaderTemplate>
                <ItemTemplate>
                    <table>
                        <tr>
                            <td style="width: 41px;">
                                <asp:ImageButton ID="btnDelete" runat="server" CommandArgument='<%# Eval("MsgId") %>'
                                    ImageUrl="~/Images/massage/delete_icon.png" OnClick="btnDelete_OnClick" />
                            </td>
                            <td>
                                <img src="../Images/massage/line_division_between-icons.png" />
                            </td>
                            <td style="width: 40px;">
                                <asp:ImageButton runat="server" ID="HyperLinkAddNew" PostBackUrl="<%#String.Format(&quot;EditMessage.aspx?MsgId={0}&quot;,Eval(&quot;MsgId&quot;))%>"
                                    ImageUrl="~/Images/massage/magnify_massage_icon.png" />
                            </td>
                        </tr>
                    </table>
                    <cc1:ConfirmButtonExtender TargetControlID="btnDelete" runat="server" ConfirmText=" are you sure you want to delete this message? ">
                    </cc1:ConfirmButtonExtender>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderStyle-Width="326" ItemStyle-VerticalAlign="Top" SortExpression="MsgText" HeaderText='<%$Dict:Messages.MsgText %>'>
                <ItemTemplate>
                    <div style="padding-left: 7px;">
                        <uc:scrollabelTxt  Width="326" runat="server" text='<%# Eval("MsgText") %>' />
                    </div>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField HeaderStyle-CssClass="dottedLineRightHeader" DataField="MsgTitle"
                HeaderStyle-Width="128" HeaderText='<%$Dict:Messages.MsgTitle %>' ReadOnly="True"
                SortExpression="MsgTitle" />
            <asp:BoundField HeaderStyle-CssClass="dottedLineRightHeader" DataField="ExpirationDate"
                HeaderStyle-Width="134" HeaderText='<%$Dict:Messages.ExpirationDate %>' ReadOnly="True"
                DataFormatString="{0:dd/MM/yyyy}" SortExpression="ExpirationDate" />
            <asp:TemplateField HeaderText='<%$Dict:Messages.DisplayMsg %>' HeaderStyle-Width="51"
                SortExpression="DisplayMsg">
                <ItemTemplate>
                <center>
                <uc:StyledCheckBox Checked='<%# Eval("DisplayMsg") %>' runat="server" readOnly="true" />
             </center>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
    <asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="MLY.Dal.lqKbmDataContext"
        OrderBy="ExpirationDate desc" Select="new (MsgId, MsgText, MsgTitle, ExpirationDate, DisplayMsg)"
        TableName="TableMessages" Where="OrganizationId == @OrganizationId">
        <WhereParameters>
            <asp:SessionParameter DefaultValue="0" Name="OrganizationId" SessionField="OrganizationId"
                Type="Int32" />
        </WhereParameters>
    </asp:LinqDataSource>
    <div id="divEmptyGrid" visible="false" class="gridRow" runat="server">
        <asp:Label ID="lblNoMessages" Text="<%$Dict:Messages.lblNoMessages%>" runat="server"></asp:Label>
        <asp:ImageButton ID="imgAddNewOnNoRows" ImageUrl="~/Images/imgbtnAdd.png" runat="server"
            OnClick="imgAddNewOnNoRows_Click" />
    </div>
</asp:Content>
